<template>
  <div style="height:220px;overflow:hidden; ">
    <el-card class="box-card" shadow="never">
      <div slot="header" class="clearfix">
        <span>政务督查</span>
        <div style="float: right; padding: 3px 0" type="text">
          <a @click="showDetails()">查看全部 &gt;</a>
        </div>
      </div>
      <el-table :show-header="false" :data="read" class="left_menu_side">
        <el-table-column prop="SXMC" :show-overflow-tooltip="true" label="事项名称">
          <template slot-scope="scope">
            <a @click="showSingle(scope.row)">{{scope.row.SXMC}}</a>
          </template>
        </el-table-column>
        <el-table-column prop="ZRCS" :show-overflow-tooltip="true" label="责任处室"></el-table-column>
        <el-table-column prop="Status" :show-overflow-tooltip="true" label="填报时限"></el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script type="text/javascript">
  import { ACCESS_TOKEN } from '@/store/mutation-types'
  import Vue from 'vue'
  import { openIFrame } from '@/utils/util'

  const baseUrl = process.env.VUE_APP_ADD_HTTP
  const ticket = Vue.ls.get(ACCESS_TOKEN)

  export default {
    data() {
      return {
        read: []
      }
    },
    mounted() {
      this.getAdminList()
    },
    methods: {
      showDetails() {
        let ReturnUrl = encodeURIComponent('/Modules/ExecutiveOffice/NewExecutive.htm')
        let url = baseUrl + '/login.xip?LoginMethod=ssologin&ticket=' +
          ticket + '&ReturnUrl=' + ReturnUrl + ''
        let title = '政务督查列表'
        openIFrame("NewExecutive", '/NewExecutiveList', title, url)
        this.$router.push({ name: "NewExecutive" })
      },
      showSingle(row) {
        let ReturnUrl = encodeURIComponent('/Modules/ExecutiveOffice/TaskReportPage.htm?TaskID=')
        let taskId = row.Task_ID
        let title = row.SXMC
        let url = baseUrl + '/Modules/Login/EgovPlatformLogin.aspx?LoginMethod=ssologin&ticket=' +
          ticket + '&ReturnUrl=' + ReturnUrl + taskId + ''
        openIFrame(row.SXMC, '/TaskReportPage/'+taskId, title, url)
        this.$router.push({ name: row.SXMC })
      },
      getAdminList() {
        let that = this
        let params = {
          serviceName: 'Xinfo.Bus.BL.Service.EgovPlatform.PortalLet.GovernmentSupervisiontPortalLetService,Xinfo.Bus.BL.Service',
          guid: 'rcgz_zwdc',
          getCount: true,
          intTypeId: 0,
          strBizType: '',
          TaskType: 1
        }
        this.getRequest('/PortalLet/GetPortalLetData', params)
          .then(res => {
            if (res.data) {
              res.data.forEach((row, index) => {
                if (index < 5) {
                  that.read.push(row)
                }
              })
            }
          })
      }
    }
  }
</script>
